
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">

			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}" action="#{pagamentoEditMB.insert}"
						rendered="#{!pagamentoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.save']}" action="#{pagamentoEditMB.update}"
						rendered="#{pagamentoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
						rendered="#{pagamentoEditMB.updateMode}" type="button" immediate="true" ajax="false" />
					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{pagamentoEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset legend="#{messages['pagamento.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="2">
					
					<h:outputLabel value="#{messages['pagamento.label.id']}: " for="id" styleClass="text-input" />
					<h:panelGrid columns="2">
						<h:outputText id="id" value="#{pagamentoEditMB.bean.id}" />
						<p:message for="id" />
					</h:panelGrid>

					
					<h:outputLabel value="#{messages['pagamento.label.unidadeOrcamentaria']}: " for="unidadeOrcamentaria" styleClass="text-input" />
					<h:panelGrid columns="5">
						<h:selectOneMenu value="#{pagamentoEditMB.unidadeOrcamentaria}" id="unidadeOrcamentaria" style="width: 350px;"
							title="#{messages['pagamento.label.unidadeOrcamentaria']}" required="true"
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{pagamentoEditMB.unidadeOrcamentarias}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="unidadeOrcamentaria" />
	
						<h:outputLabel value="#{messages['pagamento.label.obra']}: " for="obra" styleClass="text-input" />
						<h:selectOneMenu value="#{pagamentoEditMB.obra}" id="obra" style="width: 550px;"
							title="#{messages['pagamento.label.obra']}" required="true"
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{pagamentoEditMB.obras}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="obra" />
					</h:panelGrid>

					<h:outputLabel value="#{messages['pagamento.label.numDocAutorizacao']}: " for="numDocAutorizacao" styleClass="text-input" />
					<h:panelGrid columns="8">
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="numDocAutorizacao" value="#{pagamentoEditMB.bean.numDocAutorizacao}"
							title="#{messages['pagamento.alt.numDocAutorizacao']}" />
						<p:message for="numDocAutorizacao" />

						<h:outputLabel value="#{messages['pagamento.label.dataEmissao']}: " for="dataEmissao" styleClass="text-input" />
						<p:calendar id="dataEmissao" value="#{pagamentoEditMB.bean.dataEmissao}"
						   pattern="#{messages['label.date.pattern']}" navigator="true" showButtonPanel="true"
						   locale="#{currentLocale}" title="#{messages['pagamento.alt.dataEmissao']}" />
						   <p:message for="dataEmissao" />

						<h:outputLabel value="#{messages['pagamento.label.numDocFiscal']}: " for="numDocFiscal" styleClass="text-input" />
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="numDocFiscal" value="#{pagamentoEditMB.bean.numDocFiscal}"
							title="#{messages['pagamento.alt.numDocFiscal']}" />
						<p:message for="numDocFiscal" />

					</h:panelGrid>

					<h:outputLabel value="#{messages['pagamento.label.numDocPagamento']}: " for="numDocPagamento" styleClass="text-input" />
					<h:panelGrid columns="8">
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="numDocPagamento" value="#{pagamentoEditMB.bean.numDocPagamento}"
							title="#{messages['pagamento.alt.numDocPagamento']}" />
						<p:message for="numDocPagamento" />

						<h:outputLabel value="#{messages['pagamento.label.tipoDocumentoPagamento']}: " for="tipoDocumentoPagamento" styleClass="text-input" />
						<h:selectOneMenu value="#{pagamentoEditMB.tipoDocumentoPagamento}" id="tipoDocumentoPagamento" style="width: 150px;"
							title="#{messages['pagamento.label.tipoDocumentoPagamento']}" required="true"
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{pagamentoEditMB.tipoDocumentoPagamentos}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="tipoDocumentoPagamento" />

						<h:outputLabel value="#{messages['pagamento.label.dataPagamento']}: " for="dataPagamento" styleClass="text-input" />
						<p:calendar id="dataPagamento" value="#{pagamentoEditMB.bean.dataPagamento}"
						   pattern="#{messages['label.date.pattern']}" navigator="true" showButtonPanel="true"
						   locale="#{currentLocale}" title="#{messages['pagamento.alt.dataPagamento']}" />
						   <p:message for="dataPagamento" />

					</h:panelGrid>
					
					<h:outputLabel value="#{messages['pagamento.label.nomeRazaoSocial']}: " for="nomeRazaoSocial" styleClass="text-input" />
					<h:panelGrid columns="5">
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="nomeRazaoSocial" value="#{pagamentoEditMB.bean.nomeRazaoSocial}"
							title="#{messages['pagamento.alt.nomeRazaoSocial']}" />
						<p:message for="nomeRazaoSocial" />
						
						<h:outputLabel value="#{messages['pagamento.label.cnpj']}: " for="cnpj" styleClass="text-input" />
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="cnpj" value="#{pagamentoEditMB.bean.cnpj}"
							title="#{messages['pagamento.alt.cnpj']}" />
						<p:message for="cnpj" />
					</h:panelGrid>
					
					<h:outputLabel value="#{messages['pagamento.label.historicoResumido']}: " for="historicoResumido" styleClass="text-input" />
					<h:panelGrid columns="5">
						<h:inputTextarea id="historicoResumido" value="#{pagamentoEditMB.bean.historicoResumido}" style="width: 550px;" rows="3"
							title="#{messages['pagamento.alt.historicoResumido']}" />
						<p:message for="historicoResumido" />

						<h:outputLabel value="#{messages['pagamento.label.somatorioValoresPagos']}: " for="somatorioValoresPagos" styleClass="text-input" />
						<h:inputText required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" id="somatorioValoresPagos" value="#{pagamentoEditMB.somatorioValoresPagos}"
							title="#{messages['pagamento.alt.somatorioValoresPagos']}" />
						<p:message for="somatorioValoresPagos" />

					</h:panelGrid>

				</h:panelGrid>

				<p:dataTable id="listItem" var="bean" value="#{pagamentoEditMB.bean.listaBoletimMedicao}" rowIndexVar="rowIndex" >
					<f:facet name="header">#{messages['pagamento.itens.list.table.title']}</f:facet>

					<p:column sortBy="#{bean.numeroMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.numeroMedicao']}</f:facet>
							<h:outputText value="#{bean.numeroMedicao}" />
					</p:column>

					<p:column sortBy="#{bean.dataBoleim}" >
						<f:facet name="header">#{messages['pagamento.label.dataBoleim']}</f:facet>
							<h:outputText value="#{bean.dataBoleim}" />
					</p:column>

					<p:column sortBy="#{bean.dataInicioMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.dataInicioMedicao']}</f:facet>
							<h:outputText value="#{bean.dataInicioMedicao}" />
					</p:column>

					<p:column sortBy="#{bean.valorMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.valorMedicao']}</f:facet>
							<h:outputText value="#{bean.valorMedicao}" />
					</p:column>

					<p:column sortBy="#{bean.valorMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.valorPago']}</f:facet>
							<h:outputText value="#{bean.valorMedicao}" />
					</p:column>

					<p:column sortBy="#{bean.valorMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.valorAPagar']}</f:facet>
							<h:outputText value="#{bean.valorMedicao}" />
					</p:column>

					<p:column sortBy="#{bean.valorMedicao}" >
						<f:facet name="header">#{messages['pagamento.label.valorPagamento']}</f:facet>
							<h:outputText value="#{bean.valorMedicao}" />
					</p:column>
				</p:dataTable>	
			</p:fieldset>
		</h:form>
	</ui:define>
</ui:composition>